package com.mingrisoft.servlet.front;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.mingrisoft.utils.C3poUtils;

/**
 * Created by huangzf on  2018/11/19
 */
@WebServlet("/front/news")
public class FrontNewsServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        String sql = "select * from news";

        List<Map<String, Object>> news = C3poUtils.getList(sql);

        req.setAttribute("news", news);

        req.getRequestDispatcher("/WEB-INF/front/newsFrontList.jsp").forward(req, resp);
    }
}
